<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>try..catch</title>
</head>
<body>
<script>
    try {
        console.log("a");
        console.log(b);//在try里面发生的错误，不会执行错误后的try的代买
        console.log("c");
    }catch (e) {//e --> 错误对象 //捕捉错误  //error  error.message  error.name --> error
        // 发生错误时执行
        console.log(e);//ReferenceError: b is not defined
        console.log(e.message + " " + e.name);//b is not defined ReferenceError
        console.log(e.name + " : " + e.message);//ReferenceError : b is not defined
    }
    console.log("d");
</script>

</body>
</html>
